<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>会员注册</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form method="post" action="{:url('doRegist')}">
            <input type="text" name="username" placeholder="用户名" required="required" /><br />
            <input type="password" name="password" placeholder="密码" required="required" /><br />
            <input type="password" name="repassword" placeholder="确认密码" required="required" /><br />
            <button type="submit">立即注册</button>
            已有帐号？<a href="{:url('login/index')}">登录</a>
            {:token()}
        </form>
        <script type="text/javascript" src="/public/static/js/jquery-3.2.1.min.js"></script>
        <script>
            $('form').submit(function () {
                var $form = $(this);
                $.post($form.attr('action'), $form.serialize(), function (data) {
                    if (typeof (data) != 'object') {
                        alert(data);
                        return;
                    }
                    if (data.success) {
                        location.href = data.url;
                    } else {
                        alert(data.message);
                    }
                })
                return false;
            })
        </script>
    </body>
</html>
